package model;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;


public class StatechartComponentManager {

	private Map<Long, StatechartComponent> components= new HashMap<Long, StatechartComponent>();

	public StatechartComponentManager(Project project) {
		load(project);
	}

	private StatechartComponent put(Long key, StatechartComponent value) {
		return components.put(key, value);
	}

	private StatechartComponent remove(Object key) {
		return components.remove(key);
	}

	public void clear() {
		components.clear();
	}

	public boolean containsKey(Long key) {
		return components.containsKey(key);
	}

	public boolean containsValue(StatechartComponent value) {
		return components.containsValue(value);
	}

	public Set<Entry<Long, StatechartComponent>> entrySet() {
		return components.entrySet();
	}

	public StatechartComponent get(Long key) {
		return components.get(key);
	}

	public boolean isEmpty() {
		return components.isEmpty();
	}

	public Set<Long> keySet() {
		return components.keySet();
	}

	public int size() {
		return components.size();
	}

	public Collection<StatechartComponent> values() {
		return components.values();
	}

	public void load(Project project) {
		if (project != null && project.getStoredComponents() != null
				&& !project.getStoredComponents().isEmpty()) {
			for (StatechartComponent component : project.getStoredComponents()) {
				components.put(component.getId(), component);
			}
		}
	}

}
